function adduser(){
	var email = $("#signup").find("input:eq(0)").val();
	var username = $("#signup").find("input:eq(1)").val();
	var phone = $("#signup").find("input:eq(2)").val();
	var nickname = $("#signup").find("input:eq(3)").val();
	var password = $("#signup").find("input:eq(4)").val();
	var pwd = $("#signup").find("input:eq(5)").val();
	var role = $("#role").val();
	if(email==null||email==''){
		layer.msg('邮箱不能为空');
        return; 
	 }
	if(username==null||username==''){
		layer.msg('用户名不能为空');
        return; 
	 }
	if(phone==null||phone==''){
		layer.msg('电话不能为空');
        return; 
	 }
	if(nickname==null||nickname==''){
		layer.msg('名字不能为空');
        return; 
	 }
	if(password==null||password==''){
		layer.msg('密码不能为空');
        return; 
	 }
	if(pwd==null||pwd==''){
		layer.msg('请确认密码');
        return; 
	 }
	$.ajax({
		url:'/user/add',
		type:'post',
		data:{'email':email,'username':username,'phone':phone,'nickname':nickname,'password':password,'pwd':pwd,'role':role},
		dataType:'json',
		success:function(res){
			if(res.success){
				window.location.reload();
			}else{
				layer.msg(res.msg)
			}
			
		},
		error:function(){
			layer.msg('连接失败');
		}
	})
}
function findAllRole(){
	$.ajax({
		url:'/role/findAll',
		type:'get',
		dataType:'json',
		success:function(res){
			for (var i = 0; i < res.length; i++) {
				content='<option value="'+res[i].roleId+'">'+res[i].roleName+'</option>';
				$('#role').append($(content));
			}
		},
		error:function(){
			layer.msg('连接失败')
		}
	})
}











